home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / dev / gui / DesignerV1_53.lha / Designer / SuperBitMapDemo / SuperBitMapDemo.pas < prev    next >
Pascal/Delphi Source File  |  1995-04-28  |  2KB  |  119 lines

  1. program superbitmapdemowinMain;
  2.  
  3. Uses exec,intuition,gadtools,graphics,amiga,diskfont,
  4.      workbench,utility,superbitmapdemowin;
  5.  
  6.  
  7. Var
  8.  done  : boolean;
  9.  class : long;
  10.  code  : word;
  11.  pgsel : pGadget;
  12.  imsg  : pintuimessage;
  13.  dummy : long;
  14.  oldx  : word;
  15.  oldy  : word;
  16.  newx  : word;
  17.  newy  : word;
  18.  drawing  : boolean;
  19.  myborder : tborder;
  20.  
  21. const
  22.  ScreenName : string[40] = 'DesignerDemoPubScreen'#0;
  23.  
  24. function inbox:boolean;
  25. begin
  26. inbox:= (SBWin^.mousex-SBWin^.BorderLeft>7) and (SBWin^.mousex-SBWin^.BorderLeft<275) and 
  27.         (SBWin^.mousey-SBWin^.BorderTop>38) and (SBWin^.mousey-SBWin^.BorderTop<145);
  28. end;
  29.  
  30. Begin
  31. with myborder do
  32.     begin
  33.     leftedge:=0;
  34.     topedge:=0;
  35.     frontpen:=1;
  36.     BackPen:=0;
  37.     DrawMode:=jam1;
  38.     count:=2;
  39.     XY:=@oldx;
  40.     nextborder:=nil;
  41.     end;
  42. oldx:=65535;
  43. oldy:=65535;
  44. drawing:=false;
  45. done:=false;
  46. if OpenLibs then
  47.     Begin
  48.     if OpenWindowSBWin( @ScreenName[1] ) then
  49.         begin
  50.         while (not done) do
  51.             begin
  52.             dummy:=Wait(bitmask(SBWin^.UserPort^.mp_SigBit));
  53.             imsg:=GT_GetIMsg(SBWin^.UserPort);
  54.             while (imsg <>nil ) do
  55.                 begin
  56.                 class:=imsg^.Class;
  57.                 code:=imsg^.Code;
  58.                 pgsel:=pgadget(imsg^.IAddress); { Only reference if it is a gadget message }
  59.                 GT_ReplyIMsg(imsg);
  60.                 if (class=IDCMP_CLOSEWINDOW) then
  61.                     done:=true;
  62.                 if (class=IDCMP_REFRESHWINDOW) then
  63.                     begin
  64.                     GT_BeginRefresh(SBWin);
  65.                     GT_EndRefresh(SBWin, TRUE);
  66.                     end;
  67.                 if (class=IDCMP_MOUSEBUTTONS) then
  68.                     begin
  69.                     if code=selectup then
  70.                         begin
  71.                         drawing:=false;
  72.                           end
  73.                     else
  74.                         if code=selectdown then
  75.                             if inbox then
  76.                                 begin
  77.                                 drawing:=true;
  78.                                 oldx:=SBWin^.mousex-SBWin^.BorderLeft;
  79.                                 oldy:=SBWin^.mousey-SBWin^.BorderTop;
  80.                                 end;
  81.                     end;
  82.                 if (class=IDCMP_MOUSEMOVE) then
  83.                     begin
  84.                     if drawing then
  85.                         begin
  86.                         if inbox then
  87.                             begin
  88.                             newx:=SBWin^.mousex-SBWin^.BorderLeft;
  89.                             newy:=SBWin^.mousey-SBWin^.BorderTop;
  90.                             if oldx<>65535 then
  91.                               drawborder(SBWin^.rport,@myborder,0,0);
  92.                             oldx:=newx;
  93.                             oldy:=newy;
  94.                             end
  95.                         else
  96.                             begin
  97.                             oldx:=65535;
  98.                             oldy:=65535;
  99.                             end;
  100.                         end;
  101.                     end;
  102.                 if (class=IDCMP_GADGETUP) then
  103.                     begin
  104.                     if pgsel^.gadgetid=ColourGadget then
  105.                         myborder.frontpen:=code;
  106.                     end;
  107.                 imsg:=GT_GetIMsg(SBWin^.UserPort);
  108.                 end;
  109.             end;
  110.         CloseWindowSBWin;
  111.         end
  112.     else
  113.         writeln('Cannot open window.');
  114.     CloseLibs;
  115.     end
  116. else
  117.     writeln('Cannot open libraries.');
  118. end.
  119.